using JT808Protocol.Common;
using JT808Protocol.Models.BodyParserStrategy.Location;
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace JT808Protocol.Models.BodyParserStrategy
{
    /// <summary>
    /// 车辆控制应答
    /// </summary>
    public class DpVehicleControl_0x0500 : IJT808Body
    {
        /// <summary>
        /// 应答流水号
        /// </summary>
        [JsonPropertyName("应答流水号")] public ushort ReqSn { get; set; }

        /// <summary>
        /// 位置汇报，用于判断控制是否成功
        /// </summary>
        [JsonPropertyName("位置汇报")] public DrLocation_0x0200 Location { get; set; }

        public override IJT808Body ReadBody(ReadOnlySpan<byte> source, ref int startIndex)
        {
            ReqSn = ParseHelper.Uint16(ref source, startIndex);
            startIndex += 2;

            Location = new DrLocation_0x0200();
            Location.ReadBody(source, ref startIndex);

            return this;
        }

        public override List<byte> WriteToBytes()
        {
            throw new NotImplementedException();
        }
    }
}